package com.upb.webserver.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;

@Getter
@ToString
@AllArgsConstructor
public enum ContractTypeEnum {
    SOLIDITY(0, "solidity"),
    FABRIC_GO( 1, "go lang"),
    FABRIC_JAVA(2, "java"),
    NODE_JS(3, "node js"),
    ;

    private byte id;
    private String description;

    ContractTypeEnum(int id, String description) {
        this.id = (byte) id;
        this.description = description;
    }

    public static ContractTypeEnum getById(int id) {
        for (ContractTypeEnum value : ContractTypeEnum.values()) {
            if (value.id == id) {
                return value;
            }
        }
        return null;
    }
}
